using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MyPhotoIndex.Controls;

namespace MyPhotoIndex
{
    public partial class EnterKeyForm : FormTemplate
    {
        public EnterKeyForm(bool validate)
        {
            InitializeComponent();

            if (validate == false)
            {
                ReEnterKeyTextBox.Enabled = false;
            }
            else
            {
                base.OkButtonEnabled = false;
            }
        }

        public String Key
        {
            get
            {
                return KeyTextBox.Text;
            }
        }

        private void ReEnterKeyTextBox_TextChanged(object sender, EventArgs e)
        {
            if (ReEnterKeyTextBox.Enabled == false)
            {
                return;
            }

            if (String.Compare(KeyTextBox.Text, ReEnterKeyTextBox.Text) == 0 &&
               String.IsNullOrEmpty(KeyTextBox.Text) == false)
            {
                base.OkButtonEnabled = true;
            }
            else
            {
                base.OkButtonEnabled = false;
            }
        }
    }
}